home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0146_Manage Program Icons.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-08-30  |  1.6 KB  |  52 lines

  1. unit ProgIcon;
  2.  
  3. {Please feel free to use these routines as you wish, provided you keep the comments with my name in}
  4. {Any comments or problems then contact me, Andy Cooper - 100622.1041@COMPUSERVE.COM}
  5.  
  6.  
  7. interface
  8.  
  9. uses
  10.   DdeMan;
  11.  
  12. {First parameter is a ddeClientConv that has already been created on the calling form}
  13. function CreateProgManGroup(DDEClient : TDdeClientConv; strGroup : string) : Boolean;
  14. function CreateProgManItem(DDEClient : TDdeClientConv; strGroup, strItem, strFile : string) : Boolean;
  15.  
  16. implementation
  17.  
  18.  
  19. function CreateProgManGroup(DDEClient : TDdeClientConv; strGroup : string) : Boolean;
  20. {By Andy Cooper - 100622.1041@COMPUSERVE.COM}
  21. var
  22.   pstrCmd : array[0..255] of char;
  23. begin
  24.   try
  25.     StrPCopy (pstrCmd, Format('[CreateGroup(%s)]', [strGroup]) + #13#10);
  26.     Result := DDEClient.ExecuteMacro(pstrCmd, False);
  27.   except
  28.     Result := False;
  29.   end; {try}
  30. end;
  31.  
  32. function CreateProgManItem(DDEClient : TDdeClientConv; strGroup, strItem, strFile : string) : Boolean;
  33. {By Andy Cooper - 100622.1041@COMPUSERVE.COM}
  34. var
  35.   pstrCmd : array[0..255] of char;
  36. begin
  37.   try
  38.     StrPCopy (pstrCmd, Format('[ShowGroup(%s, 1)]', [strGroup]) + #13#10);
  39.     DDEClient.ExecuteMacro(pstrCmd, False);
  40.     StrPCopy (pstrCmd, Format('[ReplaceItem(%s)]', [strItem]) + #13#10);
  41.     DDEClient.ExecuteMacro(pstrCmd, False);
  42.     StrPCopy (pstrCmd, Format('[AddItem(%s,%s' + ',,)]', [strFile,strItem]) + #13#10);
  43.     Result := DDEClient.ExecuteMacro(pstrCmd, False);
  44.     StrPCopy (pstrCmd, Format('[ShowGroup(%s, 1)]', [strGroup]) + #13#10);
  45.     DDEClient.ExecuteMacro(pstrCmd, False);
  46.   except
  47.     Result := False;
  48.   end; {try}
  49. end;
  50.  
  51. end.
  52.